<?php
define('MINI_RUN', true);
require 'mini.php';
Mini::checkLogin();
?>
<!DOCTYPE html>
<html>
<head>
<title>添加全局变量--<?=Mini::NAME?>后台管理系统</title>
<?=Mini::ADMIN_CSS?>
</head>
<body>
<p class="msg">注意：有*号的内容不能为空。</p>
<form>
<input name="op" type="hidden" value="addvar" />
<p>变量名称*：<input name="varname" id="varname" type="text" /></p>
<p>变量简介*：<input name="varinfo" id="varinfo" type="text" /></p>
<p>变量内容*：</p>
<p><textarea id="vartext" name="vartext" rows="10" cols="100"></textarea></p>
<input id="addbtn" type="button" value="添加" />
</form>
<?=$js?>
<?=$js2?>
<script type="text/javascript">
$(function(){
	$("#addbtn").click(function(){		
		var regObj=/^[\w\d_]+$/;
		if(checkReg("#varname", regObj, "变量名称", "变量名称必须由字母、数字或下划线组成！")) return false;
		if(checkValue("#varinfo","变量简介")) return false;
		if(checkValue("#vartext","变量内容")) return false;
		if(checkExists(<?=Mini::AJAX_GET?>,{op:"checkvarname",varname:$("#varname").val()},"变量名称")) return false;
		setAction(<?=Mini::AJAX_SET?>,$("form").serialize(), "添加变量");
	});	
});
</script>
</body>
</html>